import { myEnv } from '@/myEnv';
import { mergeRequest } from '@/utils';
import { Activities_Web, Activities_Res } from '@/pages/_server/_class/MyActivities/ActivitiesList';
/** 获得艺术品列表 */
export const apiGetActivitesList = async () => {
    const response1: MyResponse<Activities_Res[]> = await sendRequest();
    if (!response1) return;
    const webData = response1.data.map((item) => {
        return new Activities_Web().immit_response(item);
    });
    const resonlse2: MyResponse<Activities_Web[]> = { ...response1, data: webData };
    return resonlse2;
};

const sendRequest = async () => {
    let response1: MyResponse<Activities_Res[]>;
    if (myEnv.IS_ON_LINE) {
        response1 = await mergeRequest({
            url: 'activity/summary',
            method: 'GET',
        });
    } else {
        response1 = {
            code: '200',
            message: 'ok',
            data: [
                {
                    id: '1',
                    name: '每日签到活动',
                    startTime: '2022-09-14T06:58:15.509Z',
                    endTime: '2022-09-14T06:59:41.909Z',
                    imgUrl: '/img/activity/summary/a1.png',
                },
            ],
        };
    }
    return response1;
};
